/*
 * Copyright (C) 2021 Chinasoft International
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import prompt from '@system.prompt';
let items = [
    {
        text: '浙江',
        children: [
            {id: 1,text: '温州'},
            {id: 2,text: '杭州'}
        ]
    },
    {
        text: '江苏',
        children: [
            {id: 3,text: '南京'},
            {id: 4,text: '苏州'},
            {id: 5,text: '扬州'},
            {id: 6,text: '淮安'}
        ]
    },
    {
        text: '安徽',
        children: [
            {id: 7,text: '合肥'},
            {id: 8,text: '芜湖'},
            {id: 9,text: '淮南'}
        ]
    }
];

let dotItems = [
    {
        text: '江苏',
        children: [
            {id: 3,text: '南京'},
            {id: 4,text: '苏州'},
            {id: 5,text: '扬州'}
        ],
        info: "1"
    },
    {
        text: '安徽',
        children: [
            {id: 7,text: '合肥'},
            {id: 8,text: '芜湖'}
        ],
        dot: true
    }
];

export default {
    data: {
        single: {
            items,
            mainActiveIndex: 0,
            activeId: 1
        },
        multiple: {
            items,
            mainActiveIndex: 1,
            activeId: [4, 5]
        },
        dotItems
    },
    onInit() {

    },
    changeNav1(index) {
        this.single.mainActiveIndex = index.detail;
        console.log(JSON.stringify(index.detail));
    },

    changeNav2(index) {
        this.multiple.mainActiveIndex = index.detail;
        console.log(JSON.stringify(index.detail));
    },

    getChecked1(data) {
        this.single.activeId = data.detail;
        prompt.showToast({
            message: JSON.stringify(data.detail)
        });
        console.log(JSON.stringify(data.detail));
    },
    getChecked2(data) {
        this.multiple.activeId = data.detail;
        prompt.showToast({
            message: JSON.stringify(data.detail)
        });
        console.log(JSON.stringify(data.detail));
    }
}
